import java.util.ArrayList;
import java.util.List;
//211. 添加与搜索单词 - 数据结构设计
public class WordDictionary {

    private List<String> dataList;
    public WordDictionary() {
        this.dataList=new ArrayList<>();
    }

    public void addWord(String word) {
        dataList.add(word);
    }

    public boolean search(String word) {
        boolean a=false;
        if(dataList==null||dataList.size()<=0){
            return false;
        }
        for (int i = 0; i <dataList.size() ; i++) {
            if (a){
                return true;
            }
            String s=dataList.get(i);
            if(s.length()==word.length()){
                for (int j = 0; j <word.length() ; j++) {
                    if(word.charAt(j)=='.'||word.charAt(j)==s.charAt(j)){
                        a=true;
                    }else {
                        a=false;
                        break;
                    }
                }
            }
        }
        return a;
    }



}
class Test{

    public static void main(String[] args) {
        WordDictionary wordDictionary = new WordDictionary();
        wordDictionary.addWord("a");
        System.out.println(wordDictionary.search(".")); // return False


    }
}


